package user;

import Medicine.Pharmacy;
import operation.IOPeration;

import java.sql.SQLException;


public abstract class Man {
    public String name;
    public IOPeration[] ioPerations;//在此处并不需要初始化
    public Man(String name){
        this.name=name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public abstract int menu();

    public void doOperations(int choice, Pharmacy pharmacy)  {
        //需要 Pharmacy类 中的Medicine数组
        //通过该方法 得到对应对象 以此来调用work方法
        try{
            IOPeration ioPeration = this.ioPerations[choice];
            ioPeration.work(pharmacy);
        }catch (Exception e){
            //输入越界时，抛出异常
            System.out.println("操作存在错误！！！");
        }
    }
}

